package com.xiaobai.common.utils.config.page;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
@Data
@NoArgsConstructor
public class Page<T> {

    @Schema(description = "返回数据")
    private List<T> datas;
    @Schema(description = "数据总数")
    private Integer total = 0;
    @Schema(description = "页码")
    private Integer page = 1;
    @Schema(description = "每页数据量")
    private Integer pageSize = 10;

    public Page(int page, int pageSize) {
        if (pageSize > 0) {
            this.page = page;
        }

        if (pageSize > 0) {
            this.pageSize = pageSize;
        }

    }

    public Page(List<T> datas, Integer total) {
        this.datas = datas;
        this.total = total;
    }
}
